using TTSDK;
using TTSDK.UNBridgeLib.LitJson;
using UnityEngine;
using UnityEngine.UI;



public class TTSiderBar : MonoBehaviour
{
    public Button goSiderBar;
    public Button Closebtn;

    private void Awake()
    {
        this.gameObject.SetActive(false);
        goSiderBar.onClick.AddListener(GoSiderBar);
        Closebtn.onClick.AddListener(() => { 
            this.gameObject.SetActive(false);    
        });
            
    }

    private void GoSiderBar()
    {
        var data = new JsonData
        {
            ["scene"] = "sidebar",
        };
        TT.NavigateToScene(data, () =>
        {
            Debug.Log("navigate to scene success");
            this.gameObject.SetActive(false);
        }, () =>
        {
            Debug.Log("navigate to scene complete");
        }, (errCode, errMsg) =>
        {
            Debug.Log($"navigate to scene error, errCode:{errCode}, errMsg:{errMsg}");
        });
    }
}
